<template>
  <div>
    <BasicTable @register="registerTable">
      <template #action="{ record }">
        <TableAction
          :actions="[
            {
              icon: 'ant-design:eye-outlined',
              label: '查看详情',
              onClick: handleWatch.bind(null, record),
            },
          ]"
        />
      </template>
    </BasicTable>
    <DetailModal @register="register" />
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
  export default defineComponent({
    name: 'SysOpLog',
  });
</script>
<script lang="ts" setup>
  import { BasicTable, useTable, TableAction } from '@/components/Table';
  import { getSysOpLogPage } from '@/api/sys/sysOpLogManage';
  import { columns, searchFormSchema } from './data';
  import DetailModal from './DetailModal.vue';
  import { useModal } from '@/components/Modal';

  const [registerTable] = useTable({
    title: '列表',
    api: getSysOpLogPage,
    columns,
    formConfig: {
      labelWidth: 120,
      schemas: searchFormSchema,
    },
    useSearchForm: true,
    bordered: true,
    showIndexColumn: false,
    actionColumn: {
      width: 120,
      title: '操作',
      dataIndex: 'action',
      slots: { customRender: 'action' },
    },
  });
  const [register, { openModal }] = useModal();
  const handleWatch = (record: Recordable) => {
    openModal(true, record);
  };
</script>
